﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Social.Game.DAL;

namespace SocialGame.Business
{
    public class SystemManager
    {

        public static bool ValidUser(string userName, string password)
        {
            var db = DbUtil.Database;
            User user = db.SingleOrDefault<User>(@"SELECT * FROM Users 
                                                  Where UserName = @0 and Password = @1", userName, password);
            return user != null;
        }


        public static List<User> GetListUser(string userName)
        {
            var db = DbUtil.Database;
            if (userName == null) userName = string.Empty;
            var listUser = db.Query<User>(@"SELECT * FROM Users 
                                                  Where UserName Like  @0", userName + "%");
            return listUser.ToList();
        }
    }
}